﻿<%@ Page language="c#" Codebehind="Plan.aspx.cs" AutoEventWireup="false" Inherits="zsproject.page.Plan" %> 
<%@ Import Namespace="eap.share" %>
<%@ Import Namespace="zsproject.page" %>
<%
	//---------------------------------------------------------------//
	string page=Req.getPara(Request,"page");
	string mainPage=Sys.fieldGet(page,1,"_");
	string actionPage=Sys.fieldGet(page,1,"_")+"_action";
	string SCRIPT_NAME=AdminLib.getSimpleRequestURL(Request);
	AdminUser user = (AdminUser)Session["_user"];

	string actlist=(string)output["actlist"];
	int pageRowNum = 20;
	int pageNum = 1;
	if(Req.getPara(Request,"n") != "")
	{
	  pageNum = Convert.ToInt32(Req.getPara(Request,"n").Trim());
	  pageRowNum = Convert.ToInt32(((AdminUser)Session["_user"])["cfg_list"]);      
	}
	//---------------------------------------------------------------//

	string t=Req.getPara(Request,"t");
	string WEB_PAGE =Request.Url.ToString().Replace("&",",");
	string l=Req.getPara(Request,"l");
	string p=Req.getPara(Request,"p");
	string a=Req.getPara(Request,"a"); 
	string tt=Req.getPara(Request,"tt"); 
	string group_id=Req.getPara(Request,"group_id"); 
	//查询属于下属
	if(group_id=="")
	{
		//查询所有管辖区域的企业
		group_id= user["dept_id"];
	}
	
	string method=Req.getPara(Request,"method");
	string method_name=Req.getPara(Request,"method_name");
%>
<html>
<head>
<title><%=AdminLib.STR_TITLE%></title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<meta HTTP-EQUIV='Pragma' CONTENT='no-cache'>
<meta http-equiv='Content-Type' content='text/html; charset=gbk'>
<link rel='stylesheet' href='<%=user.getSkinPath()%>css/eap.css'>
<script language='javascript' src='..<%=AdminLib.EAP_PATH%>/eap.js'></script>
<link rel='stylesheet' href='../skin/zsproject.css'>
<script language='javascript' src='../skin/zsproject.js'></script>
<script charset="UTF-8" src="../tools/kindeditor/kindeditor.js"></script>
<script language='javascript' src="../skin/validation.js"></script>
<script language="javascript" type="text/javascript" src="../tools/My97DatePicker/WdatePicker.js"></script>

<style type="text/css" >
.formitem{background-color: #CBCBCC;}
.formitem th{height:22px; background-color:#E0F1FB;padding-left:3px;text-align:right;}
.formitem td{padding:3px;background-color:#ffffff; line-height:20px;}
</style>

</head>
<!-------------------------------------------框架-------------------------------------->
<%if(t.IndexOf("frame")!=-1){%>
<frameset cols="180,*" frameborder="0" border="0" framespacing="0">
	<frame name="tree" src="../page/tree.aspx?page=<%=t%>&tt=<%=tt%>&l=<%=l%>&p=<%=p%>&a=<%=a%>&f=<%=WEB_PAGE.Replace(t,"")%>" frameborder=yes>
	<frame name="right" src="../page/firm.aspx?page=List&method=<%=method%>" frameborder=yes>
</frameset>
<%return;}%>
<!-------------------------------------------框架-------------------------------------->
<body class="bodyframe" leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">  
<!--#INCLUDE FILE="../epass/verify.aspx"-->
 
<%//信息管理
 if(page=="List"){
   string search_title =(string)output["search_title"];
   System.Data.DataRowCollection list=(System.Data.DataRowCollection)output["list"];
   AdminList lst=(AdminList)output["lst"];
%>

<table class="linetitle" border="0" width="100%" cellspacing="0" cellpadding="1">
<tr>
   <td>
      <table width="100%" border="0" cellspacing="0" cellpadding="0" class="pagetoobar">
         <tr  height="26">
            <td><strong>&nbsp;&nbsp;教学计划列表</strong></td>
            <td align="right" style="display:none"><input class="ButtonCss" onmouseover="this.className='ButtonCss_mouseover'" onmouseout="this.className='ButtonCss_mouseout'" id="btn_new" type="button" value="新增"  onclick="window.document.location.href='<%=SCRIPT_NAME%>?page=Form&method=edit';"></td>
         </tr>
      </table>
   </td>
</tr>
</table>

<table class=tbsearch border=0 width=100% cellspacing=0 cellpadding=1 style="">
<form name=frmMain method="get" action="<%=lst.getQryURL()%>"><%=lst.getQryURL2()%>
<tr><td>
关键字查询<input type=text size=30 maxlength=151 name="k" value="<%=lst.getKey()%>">
<input type=submit class="ButtonCss" onmouseover="this.className='ButtonCss_mouseover'" onmouseout="this.className='ButtonCss_mouseout'" value="查询" title="<%=search_title%>"> 
</td></tr>
</form>
</table>

<table class="tbsearch" border="0" width="100%" cellspacing="0" cellpadding="1">
	<tr>
		<td>
			<nolayer>
				<iframe name="_action" height="16" width="100%" marginwidth="0" marginheight="0" scrolling="no"
					frameborder="0" src='../admin/office.aspx?page=_action'></iframe>
			</nolayer>
		</td>
	</tr>
</table>
<script type='text/javascript'>popup_path='../admin/popup.aspx';</script>
 
<fieldset class="tfieldset" >

	<legend>
	<table width="100%" cellpadding="0" cellspacing="0">
	   <tr><td class="title"><span>&nbsp;信息列表</span></td> 
	   <td align="right"><span>
	   
	   <%if(Sys.exists(actlist,"81")){%>
			<input class="ButtonCss" onmouseover="this.className='ButtonCss_mouseover'" onmouseout="this.className='ButtonCss_mouseout'" id="btn_new" type="button" value="新增"  onclick="window.document.location.href='<%=SCRIPT_NAME+"?page=Form&method=edit&group_id="+group_id%>'">
	   <%}%>
	   
	   <%if(Sys.exists(actlist,"84")){%>
			<input type=button value="删除" title="删除上述选中的记录" class="ButtonCss" onmouseover="this.className='ButtonCss_mouseover'" onmouseout="this.className='ButtonCss_mouseout'" onClick="confirmdel_var(frmg)">
	   <%}%>
		
	</span></td></tr>
	</table>
	</legend>

	<div id="tbl-container" style="height:340px">
		<table id="datagrid" border="0" width="100%" cellPadding=0 cellSpacing="0" bgcolor="#99ccff">
			<form  method="POST" action="<%=SCRIPT_NAME+"?page="+actionPage%>" target=_action id="frmg" name="frmg">
			<thead>
				<tr class=linetitle align=center>    
					<th><input type="checkbox" name="chkall" value="on" onClick="checkall(this.form)"  title="全选(删除)"></th>
					<th nowrap><%=lst.getOrder(user,"id","ID","序号")%></th>
					<th nowrap>操作</th>
					<!--------获取标题-------->
					<th nowrap><%=lst.getOrder(user,"t_year_id","t_year_id","年度")%></th>
					<th nowrap><%=lst.getOrder(user,"t_semester_id","t_semester_id","学期")%></th>
					<!--
					<th nowrap><%=lst.getOrder(user,"t_grade_id","t_grade_id","所属年级")%></th>
					<th nowrap><%=lst.getOrder(user,"t_class_id","t_class_id","所属班级")%></th>
					<th nowrap><%=lst.getOrder(user,"t_specialty_id","t_specialty_id","所属专业")%></th>
					-->
					<th nowrap><%=lst.getOrder(user,"plan_title","plan_title","计划标题")%></th>
					<th nowrap><%=lst.getOrder(user,"plan_pay_time","plan_pay_time","缴交时间")%></th>
					<!--
					<th nowrap><%=lst.getOrder(user,"add_time","add_time","录入时间")%></th>
					<th nowrap><%=lst.getOrder(user,"add_user","add_user","录入人员")%></th>
					-->
				</tr>
			</thead>
			
			<tbody>	
				<%for(int index=0;list!=null&&index<list.Count;index++){
					System.Data.DataRow map=list[index];
					string id=map["id"].ToString();
				%>
				<tr align=center class=<%if(index % 2 ==1){%>datalineone<%}else{%>datalineone<%}%> onmouseover="dataline_over(this)" onmouseout="dataline_out(this)" onclick="dataline_click(this)">    
					<td nowrap width=60px><input type="checkbox" name="chk_id" id="chk_id" value="<%=map["id"]%>" title="选择(删除)"></td>
					<td nowrap width=60px><%=index+1+(pageNum-1)*pageRowNum%></td>
					<td nowrap width="120px">
						<%if(Sys.exists(actlist,"82")){%>
							<input type="button" class="ButtonCss" value="编辑" onclick="window.location.href='<%=SCRIPT_NAME+"?page=Form&method=edit&d="+id%>'">
						<%}%>
						
						<%if(Sys.exists(actlist,"83")){%>
							<input type="button" class="ButtonCss" value="浏览" onclick="window.location.href='<%=SCRIPT_NAME+"?page=Form&method=view&d="+id%>'">
						<%}%>
					</td>
					<!--------获取信息-------->
					<td nowrap align="center"><%=map["t_year_id"].ToString()%></td>
					<td nowrap align="center"><%=map["t_semester_id"].ToString()%></td>
					<!--
					<td nowrap align="center"><%=map["t_grade_id"].ToString()%></td>
					<td nowrap align="center"><%=map["t_class_id"].ToString()%></td>
					<td nowrap align="center"><%=map["t_specialty_id"].ToString()%></td>
					-->
					<td nowrap align="center"><%=map["plan_title"].ToString()%></td>
					<td nowrap align="center"><%=map["plan_pay_time"].ToString()%></td>
					<!--
					<td nowrap align="center"><%=map["add_time"].ToString()%></td>
					<td nowrap align="center"><%=map["add_user"].ToString()%></td>
					-->
				</tr>
				<%}%>
				<tr class=lineaction style="display:none">
				<td colspan=14 align="left">
				<input type=hidden name=action value="delete">
				<input type=hidden name=d value="">
				<input type=hidden name=reload value="">
				<input type=button value="删除" title="删除上述选中的记录" class="ButtonCss" onmouseover="this.className='ButtonCss_mouseover'" onmouseout="this.className='ButtonCss_mouseout'" onClick="javascript:if(confirm_selected(this.form)){ action.value='delete'; reload.value='reload'; submit(); }">
				</td>
				</tr>
				
			</tbody>
			</form>
		</table>
	</div>
</fieldset>

<table width=100% cellspacing=0 cellpadding=1>
	<tr height=22 align=right>
		<td align="center"> <script>if(document.getElementById("dataGrid").rows.length<=2){document.write("<font color='#ff0000'>查询无结果</font>");}</script></td>
		<td><%=lst.getPageBar()%>页码<%=lst.getPageList()%></td>
	</tr>
</table>
<%}%>

<%
//新增修改页面
if(page=="Form"){
	string edit="";
	System.Data.DataRow map=(System.Data.DataRow)output["map"];
	System.Data.DataRow mapList=(System.Data.DataRow)output["mapList"];
	System.Data.DataRowCollection listAtt=(System.Data.DataRowCollection)output["listAtt"];

	string d=Req.getPara(Request,"d");
	string id=d;
	//定义除了主键以外的字段
	string t_year_id="";
	string t_semester_id="";
	string t_grade_id="";
	string t_class_id="";
	string t_specialty_id="";
	string plan_title="";
	string plan_content="";
	string plan_pay_time="";
	string add_time="";
	string add_user="";
	if(map!=null)
	{
		//获取数据库信息
		t_year_id=map["t_year_id"].ToString();
		t_semester_id=map["t_semester_id"].ToString();
		t_grade_id=map["t_grade_id"].ToString();
		t_class_id=map["t_class_id"].ToString();
		t_specialty_id=map["t_specialty_id"].ToString();
		plan_title=map["plan_title"].ToString();
		plan_content=map["plan_content"].ToString();
		plan_pay_time=map["plan_pay_time"].ToString();
		add_time=map["add_time"].ToString();
		add_user=map["add_user"].ToString();

	}else
	{
		//新增,默认值
		add_time=DateTime.Now.Date.ToString("yyyy-MM-dd");
		add_user=user["id"];
	}
%>

<table class="linetitle" border="0" width="100%" cellspacing="0" cellpadding="1">
<tr>
   <td>
      <table width="100%" border="0" cellspacing="0" cellpadding="0" class="pagetoobar">
         <tr height="26">
            <td><strong>&nbsp;&nbsp;教学计划信息</strong></td>
         </tr>
      </table>
   </td>
</tr>
</table>

<%=AdminLib.getIframe()%>

<table id="" class="formitem" cellspacing="1" cellpadding="0" align="center" border="0" style="background-color:#7F96BE;border-width:0px;width:100%; margin-top:5px">
<form id="frmMain"  name=frmMain method=post target="_action" enctype="multipart/form-data" action="<%=SCRIPT_NAME+"?page="+actionPage+"&d="+id%>">
	<tbody>
		<!--------获取控件--------->
		<tr>
			<th align="right">年度：</th>
			<td>
				<select id="t_year_id" name="t_year_id">
				<option value="">--请选择--</option>
				<%=AdminLib.getOptionSql("SELECT year_name as value,year_name as title from t_year order by year_name",t_year_id)%>
				</select>
				
			</td>
		</tr>
		<tr>
			<th align="right">学期：</th>
			<td>
				<select id="t_semester_id" name="t_semester_id">
				<option value="">--请选择--</option>
				<%=AdminLib.getOptionSql("SELECT semester_name as value,semester_name as title from t_semester order by semester_name",t_semester_id)%>
				</select>
			</td>
		</tr>
		<tr>
			<th align="right">所属年级：</th>
			<td>
				<select id="t_grade_id" name="t_grade_id">
				<option value="">--请选择--</option>
				<%=AdminLib.getOptionSql("SELECT id as value,grade_name as title from t_grade order by grade_name",t_grade_id)%>
				</select>
			</td>
		</tr>
		<!--
		<tr>
			<th align="right">所属班级：</th>
			<td>
				<select id="t_class_id" name="t_class_id">
				<option value="">--请选择--</option>
				<%=AdminLib.getOptionSql("str_sql",t_class_id)%>
				</select>
			</td>
		</tr>
		-->
		<tr>
			<th align="right">所属专业：</th>
			<td>
				<select id="t_specialty_id" name="t_specialty_id">
				<option value="">--请选择--</option>
				<%=AdminLib.getOptionSql("SELECT id as value,specialty_name as title from t_specialty where specialty_super !='' order by specialty_order",t_specialty_id)%>
				</select>
			</td>
		</tr>
		<tr>
			<th align="right">计划标题：</th>
			<td>
				<input type="text" id="plan_title" name="plan_title" value="<%=plan_title%>" <%=edit%> style="WIDTH: 20%; TEXT-ALIGN: left;TEXT-VALIGN:middle">
			</td>
		</tr>
		<tr>
			<th align="right">计划内容：</th>
			<td>
				<textarea  id="plan_content" name="plan_content" style="width:100%;height:100px;visibility:hidden;"><%=plan_content%></textarea>
				<script>		
				KE.show({
						id : 'plan_content',
						resizeMode : 1,
						allowPreviewEmoticons : false,
						allowUpload : false,
						items : [
						'fontname', 'fontsize', '|', 'textcolor', 'bgcolor', 'bold', 'italic', 'underline',
						'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
						'insertunorderedlist', '|', 'emoticons', 'image', 'link']
					});
				</script>
			</td>
		</tr>
		<tr>
			<th align="right">缴交时间：</th>
			<td>
				<input type="text" id="plan_pay_time" name="plan_pay_time" value="<%=plan_pay_time%>" class="txt_calendar" style="WIDTH: 20%; TEXT-ALIGN: left;TEXT-VALIGN:middle">
			</td>
		</tr>
		<!--
		<tr>
			<th align="right">录入时间：</th>
			<td>
				
			</td>
		</tr>
		<tr>
			<th align="right">录入人员：</th>
			<td>
				
			</td>
		</tr>
		-->
		
		<tr>
			<td width="10%"></td>
			<td width="40%"></td>
		</tr>
						
		<tr style="display:none">
			<!--隐藏(hidden)-->
			<input type="hidden" id="add_time" name="add_time" value="<%=add_time%>">
			<input type="hidden" id="add_user" name="add_user" value="<%=add_user%>">
			
			<input type="hidden" id="action" name="action" value="">
			<input type=hidden id="reload" checked name="reload" value='<%=SCRIPT_NAME+"?page=Form&method=edit"%>' >
		</tr>
		
		<!-------------------------------------------------附件操作------------------------------------------------->
		<script>		
		//删除附件
		function delatt(del_id)
		{
			document.getElementById("action").value="del_att";	
			document.getElementById("del_id").value=del_id; 
			document.getElementById("reload").value='<%=SCRIPT_NAME+"?page=Form&method="+method+"&d="+d%>'								
		}
		</script>
	      
		<%if(listAtt!=null && listAtt.Count>0){%> 
		<tr>
			<td align=center rowspan='2'>
				<p align="center">正文附件<input type=hidden name="del_id" id="del_id" value=""></p></td>
			<td colspan="24">
				<table width="100%" border="1" cellspacing="0" cellpadding="2">
					<tr class="tbsearch">									 
						<td align="center">
						<input name="hid_accessory_ids" type="hidden" id="hid_accessory_ids" value='<%=(map==null?"":map["accessory_ids"])%>'>
						<input name="hid_reload" type="hidden" id="hid_reload" value='<%=Request.Url%>'>
						附件名</td>
						<td align="center">操作</td>
					</tr>
					
					<%for(int ii=0;ii<listAtt.Count;ii++){%>
					<tr>									 
						<td>
							<%string t3_upload_name=Sys.encode(listAtt[ii]["doc_attname"].ToString()).Replace("%","%25").Replace("+","%2B").Replace("&","%26").Replace("\"","%22").Replace("<","%3C").Replace(">","%3E").Replace("\\","%5C").Replace("'","%27").Replace("?","%3F").Replace("=","%3D");
							string t3_upload_file=Sys.encode(listAtt[ii]["doc_attfile"].ToString()).Replace("%","%25").Replace("+","%2B").Replace("&","%26").Replace("\"","%22").Replace("<","%3C").Replace(">","%3E").Replace("\\","%5C").Replace("'","%27").Replace("?","%3F").Replace("=","%3D");
							%>
							<a href=..<%=AdminLib.EAP_PATH%>/popup2.aspx?page=download&title=<%=t3_upload_name%>&attach=<%=t3_upload_file%> style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体;COLOR: blue">
								<%=listAtt[ii]["doc_attname"]%>
							</a>
						</td>

						<td>
							<%if(edit=="" && listAtt[ii]["upload_user"].ToString()==user["id"]){%>
							<input class="ButtonCss" onmouseover="this.className='ButtonCss_mouseover'" onmouseout="this.className='ButtonCss_mouseout'"type="submit" value="删除"  onclick="return delatt('<%=listAtt[ii]["id"]%>')">
							<%}else{%>
							&nbsp;
							<%}%>					
						</td>
					</tr>
					<%}%>
				</table>
			</td>
		</tr>	
		<%}%>				
		<tr> 
			<%if((edit=="")){%>
			<%if(listAtt==null){%>
			<td align=center>
				<p align="center">正文附件</p></td>
			<%}%> 			 
			<td colspan="24">
				<select name="attach" style="width:394px" size="2" multiple></select>
				<input type="button" onClick="javascript:delete_list_item(attach,false);save_list_item(attach,add_attname,add_attfile);"value="删除" class="ButtonCss" onmouseover="this.className='ButtonCss_mouseover'" onmouseout="this.className='ButtonCss_mouseout'">
				</br>
				<select style="DISPLAY: none" name="add_attfile" multiple></select>
				<select style="DISPLAY: none" name="add_attname" multiple></select>
				<nolayer>
					<iframe name=_fileupload height=24 width=450px marginwidth=0 marginheight=0 scrolling=no frameborder=0 src='..<%=AdminLib.EAP_PATH%>/popup2.aspx?page=fileupload&dir=gwsz&prefix=firm'>
					</iframe>
				</nolayer>
				
				<SCRIPT language="JavaScript">
				<!--
					function fileUpload(text,value)
					{
					var newOption = new Option(text,value);
					var len= document.frmMain.attach.length;
					if(len>=20) alert("最多只能添加20个附件!");
					else document.frmMain.attach.options[len] = newOption;
					save_list_item(document.frmMain.attach,document.frmMain.add_attname,document.frmMain.add_attfile);
					}
				-->
				</SCRIPT>
			</td>
		</tr>
		<%}%>
		<!-------------------------------------------------附件操作------------------------------------------------->
	      
		<tr>
			<script>
				//操作						
				function toEdit()
				{	
					document.getElementById("action").value="edit";								
					document.getElementById("reload").value='<%=SCRIPT_NAME+"?page=Form&method="+method+"&d={$id}"%>'
				}
			</script>
			<!--按钮-->
			<td colspan="43" align="center">
				<%if(method!="view"){
				%>
					<input type="submit" name="edit" class="ButtonCss" value="保存" title="保存操作" onclick="return toEdit();">
				<%}%>
				
				<input type="button" class="ButtonCss" onclick='window.history.back();' value="返 回" />
			</td>
		</tr>
	</tbody>
</table>
</form>
<%}%>

</body>
</html>